<%@ page contentType="text/html; charset=utf-8" %>
<%-- 
    JSP Name : list.jsp
    Description : 전시차량 리스트
    author ETLee
    since 2012. 6. 28.
    version 1.0
    Modification Information
       since          author              description
    ===========    =============    ===========================
    2012. 6. 28.     ETLee     최초 생성
--%>
<%@ include file="/WEB-INF/jsp/com/include/declare.jspf" %>
<%@ include file="/WEB-INF/jsp/com/include/doctype.jspf" %>
<c:set var="domain">${header.host}</c:set>
<c:choose>
    <c:when test="${domain == 'krdev.hyundai.com'}">
    <!-- krdev.hyundai.com naver api key -->
    <script type="text/javascript" src="http://openapi.map.naver.com/openapi/naverMap.naver?ver=2.0&key=48889bb18d2195c1fc2c1e2ddf276d84"></script>
    </c:when>
    <c:when test="${domain == 'krdev2.hyundai.com'}">
    <!-- krdev2.hyundai.com naver api key -->
    <script type="text/javascript" src="http://openapi.map.naver.com/openapi/naverMap.naver?ver=2.0&key=310e277ce0a999d0f0da4b9ee8128294"></script>
    </c:when>
    <c:when test="${domain == 'www.hyundai.com'}">
    <!-- www.hyundai.com naver api key -->
    <script type="text/javascript" src="http://openapi.map.naver.com/openapi/naverMap.naver?ver=2.0&key=01c5128b3b1da83c6f5ddf3f634ac9f7"></script>
    </c:when>
    <c:when test="${domain == 'www3.hyundai.com'}">
    <!-- www3.hyundai.com naver api key -->
    <script type="text/javascript" src="http://openapi.map.naver.com/openapi/naverMap.naver?ver=2.0&key=c8a77349edc1766a6a2a7e13e67c1926"></script>
    </c:when>
    <c:otherwise>
    </c:otherwise>
</c:choose>
<script type="text/javascript">
    function fnListView(obj){
        var param2 = $('form[name="searchForm"]').serialize();
        if($('#searchKeyword').val() == ""){
            alert("검색어를 입력해주세요");
            return false;
        }
        $.ajax({
            type:'POST',
            url:'/kr/biz/selectCmstMgmtDtlPaging.do',
            data:param2,
            dataType:'html',
            cache:false,
            error:function(){
               alert("데이터를 가져오지 못하였습니다."); 
            },
            success:function ( html, status ){
                $('#cmListArea').html($.trim(html));
                //checkPopup();
            }
        });   
    }
    
    function fnLinkPage(pageIndex) {
        $("#pageIndex").val(pageIndex);
        fnListView();
    }

    function fnView(brCd, brScn, brViewType){
        var param = "branchCd="+ brCd +"&brScn="+ brScn +"&brViewType="+ brViewType;
        $.ajax({
            type:'POST',
            url:'/kr/biz/selectBizNwrkMgmtView.do',
            data:param,
            dataType:'html',
            cache:false,
            error:function(){
               alert("팝업의 데이터를 가져오지 못하였습니다."); 
            },
            success:function ( html, status ){
                $('#popContents').html($.trim(html));
                fnInsertPopup('#popContents');
                //checkPopup();
            }
        });
    }
    
    function fnPurView(cmEeno){
        var param = "cmEeno="+ cmEeno;
        closeLayer('#popContents');
        $.ajax({
            type:'POST',
            url:'/kr/biz/selectCmstPurCnsView.do',
            data:param,
            dataType:'html',
            cache:false,
            error:function(){
               alert("팝업의 데이터를 가져오지 못하였습니다."); 
            },
            success:function ( html, status ){
                $('#purCns').html($.trim(html));
                fnInsertPopup('#purCns');
                //checkPopup();
            }
        });
    }
    
    function cMstSeleted(cmEeno1 , brCd1,ctrCd1,brNm1,cmNm1,cmCcpc1,cmEml1){
        
        var chgMasterFlg = document.getElementById("chgMasterFlg");
        if(brNm1){
            $("#cMst").text(brNm1+"/"+cmNm1);
        }else{
            $("#cMst").text($("#brNm").val()+"/"+cmNm1);    
        }
        
        $("#cEml").text(cmCcpc1+"/"+cmNm1);
        
        var param = "";
        param += "cmEeno="+cmEeno1;
        
        isLogin("/kr/biz/selectBizNwrkMgmtPaging.do?"+param);
        
        $("#reqCtrCd").val(ctrCd1);
        $("#reqBrCd").val(brCd1);
        $("#reqCmEeno").val(cmEeno1);
        
        var reqCtrCd = document.getElementById("reqCtrCd");
        var reqBrCd = document.getElementById("reqBrCd");
        var reqCmEeno = document.getElementById("reqCmEeno");
        
        
        $.post("<c:url value='/pur/carCodeInfo.do'/>",
                {
                },
                function(data){
                    var CarInfoList = [];
                    var items = $(data).find("item");
                    var ite = items.size();
                    
                    items.each(function(index,element){
                        var object ={};
                        var carCd = $(this).find("value").eq(0).text();
                        object["carCd"] = carCd;
                        var carNm = $(this).find("value").eq(1).text();
                        object["carNm"] = carNm;
                        var vehlImgNm = $(this).find("value").eq(2).text();
                        object["vehlImgNm"] = vehlImgNm;
                        var vehlImgSn = $(this).find("value").eq(3).text();
                        object["vehlImgSn"] = vehlImgSn;
                        CarInfoList[index] = object;
                    });
                    
                    if(CarInfoList.length > 0){
                        var iRtn = 0 ;
                        var inHTML = "";
                        var iMod = 0;
                        
                        for(var i=1; i <= CarInfoList.length; i++){
                           if(iRtn ==0) {
                               inHTML = inHTML + "<div class='section' >";
                               iRtn = 1;
                           }
                           inHTML = inHTML + "<div id='carImgArea' >";
                           
                           inHTML = inHTML + "<img src='/kr/file/imagePathView.do?nrFilNm=trcarimage/" + CarInfoList[i-1]["vehlImgNm"] + "' alt='" + CarInfoList[i-1]["carNm"]+ "' onClick=\"carSelect('" + CarInfoList[i-1]["carCd"] + "','" + CarInfoList[i-1]["vehlImgNm"] + "')\" width='90' height ='55'>";
                           inHTML = inHTML + "<p class='name'>" + CarInfoList[i-1]["carNm"] + "</p>";
                           inHTML = inHTML + "</div>";
                           
                           if((i % 7) == 0){
                               iRtn = 0;
                               inHTML = inHTML + "</div>";
                           }
                           if((i == CarInfoList.length ) && (iRtn != 0)) iRtn == 0;
                           
                         }
                        
                        if(iRtn == 0){
                            inHTML = inHTML + "</div>";
                        }
                        inHTML = inHTML + "</div>";

                        document.getElementById("carInfoDiv").innerHTML = inHTML ;
                       
                   }
       
                }
            ); 
        
        closeLayer('#popContents');
        fnInsertPopup("#counselpurchase");
        return;
        //마스터 신청 또는 변경인 경우
        if(chgMasterFlg.value == 'Y'){
            
            $.post("<c:url value='/pur/changeCarMaster.do'/>",
                    {
                        'mbrSn' : '${userInfo.mbrSn}',
                        'cmEeno'     : cmEeno1
                    }, 
                    function(data){
                  
                        var result={};
                        var items = $(data).find("item");
                        items.each(function(index,element){
                           var name = $(this).find("name").text();
                           var value = $(this).find("value").text();
                           result[name] = value;
                        });
                        
                     
                        if(result["result"] =="OK"){
                            
                            var frm = $("#carMasterSearchForm")[0];
                            //frm.action="<c:url value='/pur/purCounselReqPaging.do'/>";
                           // location.reload();
                            frm.submit();

                        //if(reqURL == "") reqURL = '/pur/purCounselReqPaging.do';

                        //returnReDirectURL(reqURL) ;
                        
                         return true;
                         
                        }
                            
                    }  
                );  
                   
            
            closeLayer('#carmastersearch');    
            brOrCmstStdCarInfo();
            
            
        }else {
            var cMstNo = document.getElementById("cMstNo");
            var  brCd =  document.getElementById("brCd");
            var  callFlg =  document.getElementById("callFlg");
            
            
            var reqCtrCd = document.getElementById("reqCtrCd");
            var reqBrCd  = document.getElementById("reqBrCd");
            var reqCmEeno  = document.getElementById("reqCmEeno");
            var reqBrScn  = document.getElementById("reqBrScn");
            var cMst = document.getElementById("cMst");
            var cEml = document.getElementById("cEml");
               
            cMst.innerHTML = brNm1 +'/' + cmNm1 ;
            cEml.innerHTML = cmCcpc1 + '/' + cmEml1 ;
            
            
            reqCtrCd.value = ctrCd1;
            reqBrCd.value = brCd1;
            reqCmEeno.value = cmEeno1;
            reqBrScn.value = "1";
             
            cMstNo.value = cmEeno1 ;
            brCd.value = brCd1 ;
            callFlg.value = "1" ;
            closeLayer('#carmastersearch');     
            fnInsertPopup('#counselpurchase');
            //fnInsertPopup('#personinfopopup-catalog2');
        }
    }

    function fnInsertPopup(area){
        $(area).height('');
        $('body').dimmedFrame();
        $('.dimmed-frame').css({height:$("#wrap").height()});
        $(area).css("display", "");
        $(area).css({top:$(window).scrollTop()+150}).show();
    }
    
    function closeLayer(area){
        $('.dimmed-frame').remove();
        $(area).hide(); 
    }
    
    function carSelect(carCd,imgPath){
        
        //차랑 정보를 조회한다
        
        $.post("<c:url value='/pur/carCodeInfo.do'/>",
                {
                },
                function(data){
                    var CarInfoList = [];
                    var items = $(data).find("item");
                    var ite = items.size();
                    
                    items.each(function(index,element){
                        var object ={};
                        var carCd = $(this).find("value").eq(0).text();
                        object["carCd"] = carCd;
                        var carNm = $(this).find("value").eq(1).text();
                        object["carNm"] = carNm;
                        var vehlImgNm = $(this).find("value").eq(2).text();
                        object["vehlImgNm"] = vehlImgNm;
                        var vehlImgSn = $(this).find("value").eq(3).text();
                        object["vehlImgSn"] = vehlImgSn;
                        CarInfoList[index] = object;
                    });
                
                    document.getElementById("carInfoDiv").innerHTML = "";
                   
                    if(CarInfoList.length > 0){
                        var iRtn = 0 ;
                        var inHTML = "";
                        var iMod = 0;
                        
                        
                        for(var i=1; i <= CarInfoList.length; i++){
                           if(iRtn ==0) {
                               inHTML = inHTML + "<div class='section' >";
                               iRtn = 1;
                           }
                      
          
                           if(CarInfoList[i-1]["carCd"] == carCd){
                           inHTML = inHTML + "<div id='carImgArea' class='on'>";
                           }else{
                               inHTML = inHTML + "<div id='carImgArea' >";
                           }
                               
                           inHTML = inHTML + "<img src='/kr/file/imagePathView.do?nrFilNm=trcarimage/" + CarInfoList[i-1]["vehlImgNm"] + "' alt='" + CarInfoList[i-1]["carNm"]+ "' onClick=\"carSelect('" + CarInfoList[i-1]["carCd"] + "','" + CarInfoList[i-1]["vehlImgNm"] + "')\" width='90' height ='55'>";
                           inHTML = inHTML + "<p class='name'>" + CarInfoList[i-1]["carNm"] + "</p>";
                           inHTML = inHTML + "</div>";
                           
                           if((i % 7) == 0){
                               iRtn = 0;
                               inHTML = inHTML + "</div>";
                           }
                           if((i == CarInfoList.length ) && (iRtn != 0)) iRtn == 0;
                           
                         }
                        
                        if(iRtn == 0){
                            inHTML = inHTML + "</div>";
                        }
                        inHTML = inHTML + "</div>";

                        document.getElementById("carInfoDiv").innerHTML = inHTML ;
                       
                   }
             
                }
            );      
        
        
        var reqCarCd = document.getElementById("reqCarCd");
        
        reqCarCd.value = carCd ;
        
        //차량 등급을 조회한다.
        
        $.post("<c:url value='/pur/carGradeList.do'/>",
                {'carCd': carCd
                },
                function(data){
                    var CarGrdeInfoList = [];
                    var items = $(data).find("item");
                    var ite = items.size();
                    
                    items.each(function(index,element){
                        var object ={};
                        var carCd = $(this).find("value").eq(0).text();
                        object["carCd"] = carCd;
                        
                        var grdCd = $(this).find("value").eq(1).text();
                        object["grdCd"] = grdCd;
                        
                        var grdNm = $(this).find("value").eq(2).text();
                        object["grdNm"] = grdNm;
                        CarGrdeInfoList[index] = object;
                    });
                
                    
                    var inHTML = "";
                    
                    inHTML = inHTML + '<select  class="select1 select-type2" style="width:240px;" id="carGrdSel" name="carGrdSel" onChange="carGrdDtlSearch()">';
                    inHTML = inHTML + '<option value="">등급선택</option>';
                    
                    if(CarGrdeInfoList.length > 0){


                        for(var i=0; i<CarGrdeInfoList.length; i++){
                            inHTML = inHTML + '<option value="'+CarGrdeInfoList[i]["grdCd"]+'" >'+CarGrdeInfoList[i]["grdNm"]+'</option>';

                        }
                     }


                    inHTML = inHTML + '</select>';
                   

                    $('#spCarGrdSel').html('');  
                    $('#spCarGrdSel').html(inHTML);
                    ;
                    $('#carGrdSel').customSelect();
                                    
                    
                    
                }
            );          
        
         //차량 컬러를 조회한다.    
        
        $.post("<c:url value='/pur/carColorList.do'/>",
                {'carCd': carCd
                },
                function(data){
                    var CarColorInfoList = [];
                    var items = $(data).find("item");
                    var ite = items.size();
                    
                    items.each(function(index,element){
                        var object ={};
                        var colorCd = $(this).find("value").eq(0).text();
                        object["colorCd"] = colorCd;
                        var colorNm = $(this).find("value").eq(1).text();
                        object["colorNm"] = colorNm;
                        CarColorInfoList[index] = object;
                    });
                
                    var inHTML = "";
                    
                    inHTML = inHTML + '<select class="select1 select-type2" style="width:240px;" id="carColorSel" name="carColorSel">';
                    inHTML = inHTML + '<option value="">컬러선택</option>';
                    
                    
                    if(CarColorInfoList.length > 0){


                        for(var i=0; i<CarColorInfoList.length; i++){
                            

                            inHTML = inHTML + '<option value="'+CarColorInfoList[i]["colorCd"]+'">'+ CarColorInfoList[i]["colorNm"] + '</option>';
                        }
                     }
                    inHTML = inHTML + '</select>';
                    $('#spCarColorSel').html('');  
                    $('#spCarColorSel').html(inHTML);
                    $('#carColorSel').customSelect();
       
                }
            );          
        
      
    }
    
    function carGrdDtlSearch(){ 
        
        var grdCd = document.getElementById("carGrdSel");
      
        //차량 상세등급을 조회한다.
        if(grdCd.value == "") return ;
        
        $.post("<c:url value='/pur/carGradeDtlList.do'/>",
                {'grdCd': grdCd.value
                },
                function(data){
                    var CarGrdDtlInfoList = [];
                    var items = $(data).find("item");
                    var ite = items.size();
                    
                    items.each(function(index,element){
                        var object ={};
                        var grdCd = $(this).find("value").eq(0).text();
                        object["grdCd"] = grdCd;
                        var trimCd = $(this).find("value").eq(1).text();
                        object["trimCd"] = trimCd;
                        var trimNm = $(this).find("value").eq(2).text();
                        object["trimNm"] = trimNm;
                        CarGrdDtlInfoList[index] = object;
                    });
                
                    var inHTML = "";
                    
                    inHTML = inHTML + '<select  class="select1 select-type2" style="width:240px;" id="carGrdDtlSel" name="carGrdDtlSel">';
                    inHTML = inHTML + '<option value="">상세등급선택</option>';
                    
                    
                    if(CarGrdDtlInfoList.length > 0){

                        for(var i=0; i<CarGrdDtlInfoList.length; i++){
                            
                            inHTML = inHTML + '<option value="'+CarGrdDtlInfoList[i]["trimCd"]+'"  >'+CarGrdDtlInfoList[i]["trimNm"]+'</option>';


                        }
                     }

                    inHTML = inHTML + '</select>';
                    $('#spCarGrdDtlSel').html('');  
                    $('#spCarGrdDtlSel').html(inHTML);
                    $('#carGrdDtlSel').customSelect();
      
                } 
            );          
        

        
    }
    function mbrInfoView(){
        //지점코드
        var reqCtrCd = document.getElementById("reqCtrCd");
        var reqBrCd = document.getElementById("reqBrCd");
        var reqCmEeno = document.getElementById("reqCmEeno");
        var reqCarCd = document.getElementById("reqCarCd");
        var reqCarGrdCd = document.getElementById("carGrdSel");
        var reqCarGrdDtlCd = document.getElementById("carGrdDtlSel");
        var reqCarColorCd = document.getElementById("carColorSel");
        var callFlg = document.getElementById("callFlg");    
     
       if(reqCarGrdCd.value == ""){
           alert("등급을 선택하여 주십시요");
           reqCarGrdCd.focus();
           return ;
       }
        
       if(reqCarGrdDtlCd.value == ""){
           alert("상세 등급을 선택하여 주십시요");
           reqCarGrdDtlCd.focus();
           return ;
       }
       
       if(reqCarColorCd.value == ""){
           alert("컬러를 선택하여 주십시요");
           reqCarColorCd.focus();
           return ;
       }
         
        
        
        closeLayer('#counselpurchase');     


        fnInsertPopup('#personinfopopup-catalog2');   
    }
    
    function mbrInfoUpdate(){

        var agrChk = document.getElementById("agrChk");
        var perAgrChk = document.getElementById("perAgrChk");
        var mktAgrChk = document.getElementById("mktAgrChk");
       
        if(perAgrChk.checked != true){
            alert("개인정보 수집및 이용 목적에  동의하여 주십시요");
            perAgrChk.focus();
            return;
        }

        if(mktAgrChk.checked != true){
            alert("마케팅 활용에  동의하여 주십시요");
            mktAgrChk.focus();
            return;
        }
        
        if(agrChk.checked != true){
            alert("개인정보 보유 및 이용기간에  동의하여 주십시요");
            agrChk.focus();
            return;
        }
        

        counsel_purchase_popup_req();
    }
    
    function counsel_purchase_popup_req(){
        
        var mobileCom = document.getElementById("mobileCom");
        var hpNo2 = document.getElementById("hpNo2");
        var hpNo3 = document.getElementById("hpNo3");
        var hpNo = mobileCom.value + "-" + hpNo2.value  + "-"+ hpNo3.value ;
        
        var tymdYYYY = document.getElementById("tymdYYYY");

        var tymdMM   = document.getElementById("tymdMM");
        var tymdDD   = document.getElementById("tymdDD");
      
      
        var tymd = tymdYYYY.value + tymdMM.value + tymdDD.value;
        
        var mbrSex = document.getElementById("mbrSex");
        
        var zipScn =  document.getElementById("zipScn");  
        var zipSn01 = document.getElementById("zipSn01");
        var zipSn02 = document.getElementById("zipSn02");
        
        var zipSn = zipSn01.value  + zipSn02.value;
        
        var adr = document.getElementById("adr");

        var dtlAdr = document.getElementById("dtlAdr");
        
        var callFlg = document.getElementById("callFlg");
        var cMstNo   = document.getElementById("cMstNo");
        var brCd =  document.getElementById("brCd");
        
        var wpaNm = document.getElementById("wpaNm");
        var admzNm = document.getElementById("admzNm");

        var brInfoDiv = document.getElementById("brInfoDiv");
        var CmstInfoDiv = document.getElementById("CmstInfoDiv");
            
        var carGrdSel = document.getElementById("carGrdSel");


        if(callFlg.value == "1"){ //담당 카마스터 조회(고객정보 Update와 같이 한다)
          //담당 카마스터 조회에서 이미 자료가 Setting되어 진다
        $.post("<c:url value='/pur/selectCmstInfo.do'/>",
                {
                'mbrSn': '${userInfo.mbrSn}',
                'hpNo' : hpNo,
                'tymd' : tymd,
                'mbrSex' : mbrSex.value,
                'zipScn' : zipScn.value,
                'zipSn01': zipSn01.value,
                'zipSn02': zipSn02.value,
                'adr'    : adr.value,
                'dtlAdr' : dtlAdr.value,
                'cMstNo' : cMstNo.value,
                'schCon' : callFlg.value,
                'brCd'   :brCd.value
                },
                function(data){

                }
            );     
        }else{ //담당지점조회(고객정보 Update와 같이 한다)
            $.post("<c:url value='/pur/selectBrInfo1.do'/>",
                    {
                    'mbrSn': '${userInfo.mbrSn}',
                    'hpNo' : hpNo,
                    'tymd' : tymd,
                    'mbrSex' : mbrSex.value,
                    'zipScn' : zipScn.value,
                    'zipSn01': zipSn01.value,
                    'zipSn02': zipSn02.value,
                    'adr'    : adr.value,
                    'dtlAdr' : dtlAdr.value,
                    'brCd' : brCd.value
                    },
                    function(data){
                        
                    }
                );  
        }
        
        //지점코드
        var reqCtrCd = document.getElementById("reqCtrCd");
        var reqBrCd = document.getElementById("reqBrCd");
        var reqCmEeno = document.getElementById("reqCmEeno");
        var reqCarCd = document.getElementById("reqCarCd");
        var reqCarGrdCd = document.getElementById("carGrdSel");
        var reqCarGrdDtlCd = document.getElementById("carGrdDtlSel");
        var reqCarColorCd = document.getElementById("carColorSel");
        var callFlg = document.getElementById("callFlg");    
        
       
        $.post("<c:url value='/pur/purReqReg.do'/>",
                {
                    'reqCtrCd': reqCtrCd.value,
                    'reqBrCd': reqBrCd.value,
                    'reqCmEeno': reqCmEeno.value,
                    'reqCarCd': reqCarCd.value,
                    'reqCarGrdCd': reqCarGrdCd.value,
                    'reqCarGrdDtlCd':reqCarGrdDtlCd.value,
                    'reqCarColorCd':reqCarColorCd.value,
                    'reqMbrSn' : '${userInfo.mbrSn}',
                    'reqScnCd' : callFlg.value
                },
                function(data){
               
                    var result={};
                    var items = $(data).find("item");
                    items.each(function(index,element){
                       var name = $(this).find("name").text();
                       var value = $(this).find("value").text();
                       result[name] = value;  

                    });
       
                }
            );          
            
     
        //초기화 한다  
        reqCtrCd.value = "" ;
        reqBrCd.value = "";
        reqCmEeno.value = "";
        reqCarCd.value = "";
        reqCarGrdCd.value = "";
        reqCarGrdDtlCd.value = "";
        reqCarColorCd.value ="";
        callFlg.value = "";
        
        
        closeLayer('#personinfopopup-catalog2');     


            fnInsertPopup('#counselpurchasecheck');
        
        
    } 
    function checkClose(){
        
        $("#counselpurchasecheck").hide();

    }

    function zipCodePopUp(obj) {

    newWindow =  window.open("/kr/mbr/zipCodePopUp.do","우편번호찾기","top=500px,left=800px,height=800px,width=660px,scrollbars=yes,menubar=no,toolbar=no,status=no");

    }    
    
    $(document).ready(function() {
        $('select.select1').customSelect();
        
        var tempCmEeno = $("#tempCmEeno").val() || "";
        var tempCtrCd = $("#tempCtrCd").val() || "";
        var tempBrCd = $("#tempBrCd").val() || "";
        var tempBrNm = $("#tempBrNm").val() || "";
        var tempCmNm = $("#tempCmNm").val() || "";
        var tempCmCcpc = $("#tempCmCcpc").val() || "";
        var tempCmEml = $("#tempCmEml").val() || "";
        if(tempCmEeno){
            cMstSeleted(tempCmEeno , tempBrCd,tempCtrCd,tempBrNm,tempCmNm,tempCmCcpc,tempCmEml);    
        }
    })
</script>
</head>
<body>
<%-- <%@ include file="/WEB-INF/jsp/com/include/layerpopup.jspf" %> --%>
<div id="wrap">
    <%@ include file="/WEB-INF/jsp/com/include/navi_utill_sub.jspf" %>
    <%@ include file="/WEB-INF/jsp/com/include/navi_header.jspf" %>
    <hr />

    <%@ include file="/WEB-INF/jsp/com/include/sub_header_counsel04.jspf" %>
    <hr />

    <div id="container">
        <div id="subtitle-area"><div class="subtitle-area-inner">
            <h4><img src="/kr/images/title/h4_counsel_branch_inquiry04.gif" alt="영업사원조회" /></h4>
            <%@ include file="/WEB-INF/jsp/com/include/location.jspf" %>
        </div></div>
        <div id="article">
            <p class="default-desc"><img src="/kr/images/counsel/txt_counsel_branch_inquiry04_01.gif" alt="고객님이 찾으시는 영업사원의 정보를 쉽고 편리하게 안내해 드립니다. 고객님께서 알고 계신 영업사원의 이름 또는 지점/대리점을 검색하시면 영업사원의 정보를 보실 수 있습니다." /></p>

        <form name="searchForm" id="searchForm" action="" method="POST" onSubmit="return false">
        <input type="hidden" name="pageIndex" id="pageIndex" value="${ cmstMgmtSearchVO.pageIndex }"/>
            <div class="list-search-form02">
                <select name="searchCondition" id="searchCondition" class="select1 select-type2" style="width:230px;">
                    <option value="1">성명으로 검색</option>
                    <option value="2">지점/대리점으로 검색</option>
                </select>
                 <!-- cidow_130410 -->
				<label for="searchkeyword"></label><input type="text" name="searchKeyword" id="searchKeyword" class="txt" style="width:225px;" />
				<!-- //cidow_130410 -->
                <input type="image" src="/kr/images/common/button/btn_search03.gif" alt="SEARCH" onclick="fnListView();"/>
            </div>

            <h5 class="subsection"><img src="/kr/images/title/h5_counsel_branch_inquiry02_01.gif" alt="검색 결과" /></h5>
            <div id="cmListArea">
            <div class="boardlist-wrap">
                <table class="salesman-search" summary="이미지, 내용">
                <caption>검색 결과 리스트</caption>
                <colgroup>
                    <col width="25%" />
                    <col width="75%" />
                </colgroup>
                <thead>
                <tr>
                    <th scope="col">이미지</th>
                    <th scope="col">내용</th>
                </tr>
                </thead>
                <tbody>
                <tr>
                    <td colspan="2" class="center last">성명 또는 지점/대리점명을 입력하시고 조회 해주세요!</td>
                </tr>
                </tbody>
                </table>
            </div>
            </div>
        </form>
        </div>
    </div>
    <hr />
    <script>
    appendMETA('WT.ti','카마스터 조회');
    </script>  
    <%@include file="/WEB-INF/jsp/com/include/footer.jspf" %>

    <%-- --%>
    <!-- 구매상담 신청내역 확인 -->
    <div id="counselpurchasecheck" class="layerpopup counselpurchasecheck" style="z-index:100000"><div class="layerpopup-inner">
        <div class="layerpopup-head">
            <h1><img src="/kr/images/layerpopup/h1_counsel_purchase02.gif" alt="구매상담 신청내역 확인"/></h1>
        </div>
        <div class="layerpopup-contents">
            <div class="application-check-wrap">
                <p class="stats02">
                    ${userInfo.mbrNm } <img src="/kr/images/layerpopup/txt_application_check01.gif" alt="고객님의 서비스가 신청되었습니다." />
                </p>
            </div>
            <div class="btnwrap">
                <a href="/kr/biz/selectBizNwrkMgmtPaging.do"><img src="/kr/images/layerpopup/btn_confirm02.gif" alt="확인" class="close" /></a>
            </div>
        </div>
        <!-- close -->
        <div class="close-area"><div class="close-area-inner">
            <img src="/kr/images/layerpopup/btn_close.gif" alt="닫기" class="close" onClick="checkClose()"/>
        </div></div>
        <!-- //close -->
    </div></div>
    <!-- //구매상담 신청내역 확인 -->
    <!-- 구매상담 신청 -->
	<!-- cidow_130411 -->
    <input type="hidden" name="tempCmEeno" id="tempCmEeno" value="${cmstMgmtVO.cmEeno}" />
    <input type="hidden" name="tempCtrCd" id="tempCtrCd" value="${cmstMgmtVO.ctrCd}" />
    <input type="hidden" name="tempBrCd" id="tempBrCd" value="${cmstMgmtVO.brCd }" />
    <input type="hidden" name="tempBrNm" id="tempBrNm" value="${cmstMgmtVO.brNm }" />
    <input type="hidden" name="tempCmNm" id="tempCmNm" value="${cmstMgmtVO.cmNm}" />
    <input type="hidden" name="tempCmCcpc" id="tempCmCcpc" value="${cmstMgmtVO.cmCcpc }" />     
    <input type="hidden" name="tempCmEml" id="tempCmEml" value="${cmstMgmtVO.cmEml }" />     
    <input type="hidden" name="cMstNo" id="cMstNo" value="<c:out value="${userInfo.cmEeno}"/>" />
	<!-- //cidow_130411 -->

    <div id="personinfopopup-catalog2" class="layerpopup personinfopopup-catalog" >
    <div class="layerpopup-inner">
        <div class="layerpopup-head">
            <h1><img src="/kr/images/layerpopup/h1_person_info.gif" alt="개인정보입력" /></h1>
        </div> 
    <form id="purCounselCefForm" name="purCounselCefForm" method="post" onsubmit="return false">
         <input type="hidden" name="zipScn" id="zipScn" value="${userInfo.zipScn }">
         <input type="hidden" name="wpaNm1" id="wpaNm1" value="${purMgmtSearchVO.wpaNm}">
         <input type="hidden" name="admzNm1" id="admzNm1" value="${purMgmtSearchVO.brDtlAdr2 }">
         <c:if test="${userInfo.cmEeno !=''}">
         <input type="hidden" name="callFlg" id="callFlg"  value="1">
         </c:if>
          <c:if test="${userInfo.cmEeno ==''}">
         <input type="hidden" name="callFlg" id="callFlg"  value="">
         </c:if>
         
         <input type="hidden" name="brCd"   id="brCd" value="">
    
        <div class="layerpopup-contents">
       
            <div class="person-info-wrap">
                <h2 class="person-rule"><img src="/kr/images/layerpopup/h2_person_info.gif" alt="개인정보 수집, 이용에 관한 안내" /></h2>
                <div class="rule"><div class="inner" style="overflow-y:auto">
         <b>개인정보 수집 및 이용 목적</b><br>
                구매상담 신청 확인  용도로 사용됩니다.<br>
       - 이름 및 생년월일 : 구매상담 안내시 필요<br><br>
       - 휴대전화 : 상담 안내시 필요<br><br>
       - 주소 : 주소지와 가까운 지점으로 배정하기 위한 용도<br><br>
         
      * DM발송 대행 및 위탁업체: (주)한진, 월드피에이디, 빌포스트, 골든민커뮤니케이션<br><br><br>
       
       <b>마케팅 활용 동의</b><br>
       고객님의 구매상담 이용정보는 당사 마케팅 및 판촉정보로 활용 될 수 있습니다.<br><br><br>
       
     <b>보유/이용기간</b><br>
         - 고객님 개인정보는 신청일 기준 1년 간 보관되며, 
           기간 만료 후 자동 폐기됩니다.<br>
         - 개인정보 수집·이용에 동의를 하지 않을 시,구매상담
         이용에 제한을 받을 수 있습니다.<br><br>         
                </div></div>
    
                <div class="etc-function">
                    <label><input type="checkbox" class="check" id="perAgrChk" name="perAgrChk"/> 개인정보 수집 및 이용 목적에 동의합니다.(동의하지 않을 경우 신청 되지 않습니다.)</label>
                </div>
                <div class="etc-function">
                    <label><input type="checkbox" class="check" id="mktAgrChk" name="mktAgrChk"/> 마케팅 활용에 동의합니다(동의하지 않을 경우 신청되지 않습니다.)</label>
                </div>
                <div class="etc-function">
                    <label><input type="checkbox" class="check" id="agrChk" name="agrChk"/> 개인 정보 보유 및 이용기간에 동의합니다(동의하지 않을 경우 신청되지 않습니다.)</label>
                </div>
                <p class="desc"><img src="/kr/images/layerpopup/h1_person_info_desc03.gif" alt="구매상담 신청을 위한 고객님의 개인정보를 확인 또는 입력해 주세요." /></p>
               
                    <table summary="">
                    <colgroup>
                        <col width="20%" />
                        <col />
                    </colgroup>
                    <tbody>
                    <tr>
                        <!-- cidow_130410 -->
                        <th scope="row"><label for="person_name"><img src="/kr/images/layerpopup/txt_person_info01.png" alt="성명" /></label></th>
                        <td class="input">
                            <input type="text" id="person_name" class="txt" style="width:194px" value="${userInfo.mbrNm }" readonly/>
                        </td>
						<!-- //cidow_130410 -->
                    </tr>
                    <tr>
                        <th scope="row"><img src="/kr/images/layerpopup/txt_person_info02.png" alt="휴대폰 번호" /></th>
                        <td class="input">
                           
                            <select class="select1 select-type1" style="width:56px;" id="mobileCom" name="mobileCom">
                                <option value="010" <c:if test="${ userInfo.hpNo1 == '010' }">selected="selected"</c:if>>010</option>
                                <option value="011" <c:if test="${ userInfo.hpNo1 == '011' }">selected="selected"</c:if>>011</option>
                                <option value="016" <c:if test="${ userInfo.hpNo1 == '016' }">selected="selected"</c:if>>016</option>
                                <option value="017" <c:if test="${ userInfo.hpNo1 == '017' }">selected="selected"</c:if>>017</option>
                                <option value="018" <c:if test="${ userInfo.hpNo1 == '018' }">selected="selected"</c:if>>018</option>
                                <option value="019" <c:if test="${ userInfo.hpNo1 == '019' }">selected="selected"</c:if>>019</option>
                            </select>
                            -
                            <input type="text" class="txt" style="width:52px" title="앞자리 입력" name="hpNo2" id="hpNo2" value=${ userInfo.hpNo2}>
                            -
                            <input type="text" class="txt" style="width:52px" title="뒷자리 입력" name="hpNo3" id="hpNo3" value=${ userInfo.hpNo3}>
                        </td>
                    </tr>
                  
     
                    
                    
                    <tr>
                        <th scope="row"><img src="/kr/images/layerpopup/txt_person_info07.png" alt="생년월일" /></th>
                        <td class="input">
                            <select class="select1 select-type1" style="width:60px; overflow-" id="tymdYYYY">
                                <c:set value="2012" var="num2" />
                                <c:forEach var="i" begin="0" varStatus="status" end="107"> 
                                    <c:if test="${fn:substring(userInfo.tymd, 0, 4) == (num2 - status.index)}">
                                        <option value="<fmt:formatNumber minIntegerDigits="2" value="${num2 - status.index}" pattern="##"/>" selected="selected"><fmt:formatNumber minIntegerDigits="2" value="${num2 - status.index}" pattern="##"/></option>
                                    </c:if> 
                                    <c:if test="${fn:substring(userInfo.tymd, 0, 4) != (num2 - status.index)}">
                                        <option value="<fmt:formatNumber minIntegerDigits="2" value="${num2 - status.index}" pattern="##"/>"><fmt:formatNumber minIntegerDigits="2" value="${num2 - status.index}" pattern="##"/></option>
                                    </c:if>
                                    
                                </c:forEach>
                            </select>
                            <span class="in-input">년</span>
                            <select class="select1 select-type1 space" style="width:56px;" id="tymdMM">
                                <c:forEach var="i" begin="1" varStatus="status" end="12">
                                    <fmt:formatNumber minIntegerDigits="2" value="${status.index}" pattern="##" var="selectNum"/>
                                    <c:if test="${fn:substring(userInfo.tymd, 4, 6) == selectNum}">  
                                        <option value="${selectNum }" selected="selected">${selectNum }</option>
                                    </c:if> 
                                    <c:if test="${fn:substring(userInfo.tymd, 4, 6) != status.index}">
                                       <option value="<fmt:formatNumber minIntegerDigits="2" value="${status.index}" pattern="##"/>"><fmt:formatNumber minIntegerDigits="2" value="${status.index}" pattern="##"/></option>
                                    </c:if>
                                </c:forEach>
                            </select> 
                            <span class="in-input">월</span>
                            <select class="select1 select-type1 space" style="width:56px;" id="tymdDD">
                                <c:forEach var="i" begin="1" varStatus="status" end="31">
                                    <fmt:formatNumber minIntegerDigits="2" value="${status.index}" pattern="##" var="selectNum"/>
                                    <c:if test="${fn:substring(userInfo.tymd, 6, 8) == status.index}">
                                        <option value="${selectNum }" selected="selected">${selectNum }</option>
                                    </c:if> 
                                    <c:if test="${fn:substring(userInfo.tymd, 6, 8) != status.index}">
                                       <option value="${selectNum }">${selectNum }</option>
                                    </c:if>
                                </c:forEach>
                            </select>
                            <span class="in-input">일</span>
                        </td>
                    </tr>
                    <tr>
                        <th scope="row"><img src="/kr/images/layerpopup/txt_person_info08.png" alt="성별" /></th>
                        <td class="input">
                            <select class="select1 select-type1"  style="width:56px;" id="mbrSex" name="mbrSex">
                                <option value="M" <c:if test="${ userInfo.mbrSex =='M' }">selected="selected"</c:if>> 남</option>
                                <option value="F"  <c:if test="${ userInfo.mbrSex =='F' }">selected="selected"</c:if>>여</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <th scope="row"><img src="/kr/images/layerpopup/txt_person_info03.png" alt="주소(거주지)" /></th>
                        <td class="input">
                            <input type="text" class="txt" style="width:52px" value="${userInfo.zipSn1 }" name="zipSn01" id="zipSn01" readonly/>
                            -
                            <input type="text" class="txt" style="width:52px" value="${userInfo.zipSn2 }" name="zipSn02" id="zipSn02" readonly />
                            <a href="javascript:zipCodePopUp('zipCode');"><img src="/kr/images/layerpopup/btn_zipcode.gif" alt="우편번호 검색" /></a>
                            <div class="sect">                                                                
                                <input type="text" class="txt" style="width:378px" name="adr" id="adr" value="<c:out value= '${userInfo.adr }'/>" title="나머지 주소 입력" readonly/>
                            </div>
                            <div class="sect">
                                <input type="text" class="txt" style="width:378px" name="dtlAdr" id="dtlAdr" value="${userInfo.dtlAdr }" title="나머지 주소 입력" readonly/>
                            </div>
                        </td>
                    </tr>
                    </tbody>
                    </table>
           
                <p class="default-tip">
                    * 정확한 개인정보를 입력하지 않으시면 서비스 이용에 불이익이 있을 수 있습니다.<br />
                    * 새로 입력된 정보는 가입정보에 반영되어 업데이트 됩니다.<br />
                    * 본 개인정보는 온라인 발송업체에 제공됩니다.
                </p>
            </div>
            <div class="btnwrap">
                <a href="javascript:void(0)"><img src="/kr/images/layerpopup/btn_confirm02.gif" alt="확인" onClick="mbrInfoUpdate();"/></a>
                <a href="#"><img src="/kr/images/layerpopup/btn_cancel.gif" alt="취소" class="close"/></a>
            </div>
       
        </div>
        <!-- close -->
        <div class="close-area"><div class="close-area-inner">
            <img src="/kr/images/layerpopup/btn_close.gif" alt="닫기" class="close" />
        </div></div>
        <!-- //close -->
        </form>
    </div>
    
    </div>
    <!-- //구매상담 신청 --> 
    
    <!-- 구매상담 신청 관련 --> 
    <div id="counselpurchase" class="layerpopup counselpurchase" style="z-index:1000">
    <div class="layerpopup-inner">
    <form name="couselPurchaseForm" id= "couselPurchaseForm" onsubmit="return false">
        <input type="hidden" id="reqCtrCd" name="reqCtrCd" value= "">
        <input type="hidden" id="reqBrCd" name="reqBrCd" value="">
        <input type="hidden" id="reqCmEeno" name="reqCmEeno" value="${userInfo.cmEeno}">
        <input type="hidden" id="reqBrScn" name="reqBrScn" value="">
        <input type="hidden" id="reqCarCd" name="reqCarCd" value="">
        <input type="hidden" id="brNm" name="brNm" value="">
    
        <div class="layerpopup-head">
            <h1><img src="/kr/images/layerpopup/h1_counsel_purchase.gif" alt="구매상담 신청" /></h1>
        </div>
        <div class="layerpopup-contents">
            <div class="counsel-purchase-wrap">
                <h2><img src="/kr/images/layerpopup/h2_counsel_purchase01.gif" alt="담당 카마스터 정보" /></h2>
                <div id="CmstInfoDiv" name="CmstInfoDiv" style="dispaly:none">
                <div class="datatable-wrap02" >
                    <table summary="지점명/담당, 연락처/이메일">
                    <caption>카마스터 정보 리스트</caption>
                    <colgroup>
                        <col width="25%" />
                        <col />
                    </colgroup>
                    <tbody>
                    <tr>
                        <th scope="row" >지점명/담당</th>
                        <td id="cMst" name="cMst"></td>
                    </tr>
                    <tr>
                        <th scope="row">연락처/이메일</th>
                        <td id="cEml" name="cEml"></td>
                    </tr>
                    </tbody>
                    </table>
                </div>
                </div>
                <h2 class="subsection03"><img src="/kr/images/layerpopup/h2_counsel_purchase02.gif" alt="차량 선택" /></h2>
                <div class="exhibit-car-list-wrap">
                    <div class="exhibit-car-list" id="carInfoDiv" name="carInfoDiv">
    
                    </div>
                    <div class="grade-select">
                        <span id="spCarGrdSel" name="spCarGrdSel">
                        <select  class="select1 select-type2" style="width:240px;" id="carGrdSel" name="carGrdSel" onChange="carGrdDtlSearch()">
                            <option value="">등급선택</option>
                        </select>
                        </span>
                        <span id="spCarGrdDtlSel" name="spCarGrdDtlSel">
                        <select  class="select1 select-type2" style="width:240px;" id="carGrdDtlSel" name="carGrdDtlSel">
                            <option value="">상세등급선택</option>
                        </select>
                        </span>
                        <span id="spCarColorSel" name="spCarColorSel">
                        <select class="select1 select-type2" style="width:240px;" id="carColorSel" name="carColorSel">
                            <option value="">컬러선택</option>
                        </select>
                        </span>
                        <p class="caution">* 상기 이미지는 실제와 다를 수 있습니다.</p>
    
                    </div>
                </div>
                <div class="btnwrap">
                    <a href="javascript:void(0)"><img src="/kr/images/layerpopup/btn_counsel_application.gif" alt="상담신청" onClick="mbrInfoView();"/></a>
                    <a href="#"><img src="/kr/images/layerpopup/btn_cancel02.gif" alt="취소" class="close"/></a>
                </div>
            </div>
        </div>
        <!-- close -->
        <div class="close-area"><div class="close-area-inner">
            <img src="/kr/images/layerpopup/btn_close.gif" alt="닫기" class="close" />
        </div></div>
        <!-- //close -->
        </form>
    </div>
    
    </div>
    <!-- //구매상담 신청 관련 -->    
    <div id="purCns"></div>